#include <iostream>
using std::cout;
using std::endl;
//解密cin的原理，为什么可以放到if、while等条件语句中
class MyCin{
public:
    MyCin(int good,int fail, int bad, int eof)
    :_good(good)
    ,_fail(fail)
    ,_bad(bad)
    ,_eof(eof)
    {

    }
    //实现类型转换函数
    operator bool(){
        return _fail != 1;
    }

private:
    int _good;
    int _fail;
    int _bad;
    int _eof;
};
void test(){
    //MyCin cin(1, 0, 0, 0);
    MyCin cin(0, 1, 0, 0);
    if(cin){
        cout << "true" << endl;
    }else {
        cout << "false" << endl;
    }
}

int main()
{
    test();
    return 0;
}

